writes: auto-sync / continuous self-heal loop (#29) - #40
Merged
Merged
Conversation
Opt-in. With --env + --poll, `--auto-sync apply` triggers the project's ApplyOp (heal the cloud toward source) on a polled drift; `pull-request` triggers the ReconcileOp (adopt live → PR). Off by default. Delegated + gated as ever: behold triggers a committed Op on the executor; a gated destructive apply still pauses for Approve — auto-sync never approves. Source edits don't auto-sync (new declaration = new desired state, not drift); only polled drift does. - src/op-runner.ts: OpRunner — one place an Op is triggered, shared by the HTTP routes and the auto-sync loop, so both honour one running-guard and the post-op frame capture. Replaces the inline run logic in the route. - src/autosync.ts: AutoSyncMode + pickAutoSyncOp (pure; off/running/no-op → null). - server: poll drift → pickAutoSyncOp → runner.trigger; /api/ops exposes autoSync. - cli: --auto-sync off|apply|pull-request (needs --env + --poll); boot log. - web: auto-sync banner; the trigger streams to the now-line. tsc + 48 tests (+6 autosync). Auto-apply not live-fired (would mutate real infra); decision logic unit-tested, wiring smoke-verified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29 (epic #23). The marquee Argo write feature — opt-in, off by default.
With
--env+--poll,--auto-sync applytriggers the project's ApplyOp (heal the cloud toward source) on a polled drift;pull-requesttriggers the ReconcileOp (adopt live → PR).Safe by construction: delegated + gated as ever — behold triggers a committed Op on the executor and holds no creds; a gated (destructive) apply still pauses for Approve — auto-sync never approves. Source edits don't auto-sync (a new declaration is new desired state, not drift); only polled drift does. Off unless explicitly enabled.
How
src/op-runner.ts—OpRunner: one place an Op is triggered, shared by the HTTP routes and the auto-sync loop, so both honour a single running-guard and the post-op frame capture. Replaces the inline run logic inPOST /api/ops/:name/run.src/autosync.ts—AutoSyncMode+pickAutoSyncOp(pure: off / running / no-matching-op → null). Unit-tested.pickAutoSyncOp→runner.trigger;/api/opsexposesautoSync.--auto-sync off|apply|pull-request(requires--env+--poll); boot log.⟳ auto-sync (apply) → prod-apply).Verified
--auto-syncwithout--env+--poll, and invalid modes./api/opssurfacesautoSync; runner-backed Sync/Adopt routes unchanged.node --checkclean; 48 tests (+6 autosync).